<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />










<meta name="description" content="####1. ActiveMQ ######1). ActiveMQActiveMQ是Apache所提供的一个开源的消息系统，完全采用Java来实现，因此，它能很好地支持J2EE提出的JMS（Java Message Service,即Java消息服务）规范。JMS是一组Java应用程序接口，它提供消息的创建、发送、读取等一系列服务。JMS提供了一组公共应用程序接口和响应的语法，类似于Java数据">
<meta name="keywords" content="Android、iOS、Web、React Native">
<meta property="og:type" content="article">
<meta property="og:title" content="分布式--ActiveMQ-消息中间件(一)">
<meta property="og:url" content="http://yoursite.com/blog/2018/08/06/Distributed/分布式--ActiveMQ-消息中间件(一)/index.html">
<meta property="og:site_name" content="凌浩雨_博客">
<meta property="og:description" content="####1. ActiveMQ ######1). ActiveMQActiveMQ是Apache所提供的一个开源的消息系统，完全采用Java来实现，因此，它能很好地支持J2EE提出的JMS（Java Message Service,即Java消息服务）规范。JMS是一组Java应用程序接口，它提供消息的创建、发送、读取等一系列服务。JMS提供了一组公共应用程序接口和响应的语法，类似于Java数据">
<meta property="og:locale" content="default">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-d5903d5c31002368.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-78a5559c4f70ee40.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-eaa4a6377780ae98.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-e6007bd47c40d507.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-b751546476bcbdef.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-2bb93e71e0548882.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-60f633b1ad599ad8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-b576c10c60587ddf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-50613bc466bd4c5e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-8be89270a680738f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-3ed7988fa7d20d2b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-8099356fc7008911.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/3110861-644a5e340ef23759.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:updated_time" content="2018-08-06T11:06:19.819Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="分布式--ActiveMQ-消息中间件(一)">
<meta name="twitter:description" content="####1. ActiveMQ ######1). ActiveMQActiveMQ是Apache所提供的一个开源的消息系统，完全采用Java来实现，因此，它能很好地支持J2EE提出的JMS（Java Message Service,即Java消息服务）规范。JMS是一组Java应用程序接口，它提供消息的创建、发送、读取等一系列服务。JMS提供了一组公共应用程序接口和响应的语法，类似于Java数据">
<meta name="twitter:image" content="https://upload-images.jianshu.io/upload_images/3110861-d5903d5c31002368.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/blog/2018/08/06/Distributed/分布式--ActiveMQ-消息中间件(一)/"/>





  <title>分布式--ActiveMQ-消息中间件(一) | 凌浩雨_博客</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="default">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">凌浩雨_博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/blog/blog/2018/08/06/Distributed/分布式--ActiveMQ-消息中间件(一)/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="凌浩雨">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/blog/images/avatar.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="凌浩雨_博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">分布式--ActiveMQ-消息中间件(一)</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2018-08-06T18:01:38+08:00">
                2018-08-06
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>####1. <a href="http://activemq.apache.org/" target="_blank" rel="noopener">ActiveMQ</a></p>
<p>######1). ActiveMQ<br>ActiveMQ是Apache所提供的一个开源的消息系统，完全采用Java来实现，因此，它能很好地支持J2EE提出的JMS（Java Message Service,即Java消息服务）规范。JMS是一组Java应用程序接口，它提供消息的创建、发送、读取等一系列服务。JMS提供了一组公共应用程序接口和响应的语法，类似于Java数据库的统一访问接口JDBC,它是一种与厂商无关的API，使得Java程序能够与不同厂商的消息组件很好地进行通信。</p>
<a id="more"></a>
<p>######2). Java Message Service(JMS)<br>JMS支持两种消息发送和接收模型。</p>
<ul>
<li><p>一种称为P2P(Ponit to Point)模型，即采用点对点的方式发送消息。P2P模型是基于队列的，消息生产者发送消息到队列，消息消费者从队列中接收消息，队列的存在使得消息的异步传输称为可能，P2P模型在点对点的情况下进行消息传递时采用。<br><img src="https://upload-images.jianshu.io/upload_images/3110861-d5903d5c31002368.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图1.png"></p>
</li>
<li><p>另一种称为Pub/Sub(Publish/Subscribe，即发布-订阅)模型，发布-订阅模型定义了如何向一个内容节点发布和订阅消息，这个内容节点称为topic(主题)。主题可以认为是消息传递的中介，消息发布这将消息发布到某个主题，而消息订阅者则从主题订阅消息。主题使得消息的订阅者与消息的发布者互相保持独立，不需要进行接触即可保证消息的传递，发布-订阅模型在消息的一对多广播时采用。<br><img src="https://upload-images.jianshu.io/upload_images/3110861-78a5559c4f70ee40.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图2.png"></p>
</li>
</ul>
<p>######3). JMS术语</p>
<ul>
<li>Provider/MessageProvider：生产者</li>
<li>Consumer/MessageConsumer：消费者</li>
<li>PTP：Point To Point，点对点通信消息模型</li>
<li>Pub/Sub：Publish/Subscribe，发布订阅消息模型</li>
<li>Queue：队列，目标类型之一，和PTP结合</li>
<li>Topic：主题，目标类型之一，和Pub/Sub结合</li>
<li>ConnectionFactory：连接工厂，JMS用它创建连接</li>
<li>Connnection：JMS Client到JMS Provider的连接</li>
<li>Destination：消息目的地，由Session创建</li>
<li>Session：会话，由Connection创建，实质上就是发送、接受消息的一个线程，因此生产者、消费者都是Session创建的</li>
</ul>
<p>######4). <a href="http://activemq.apache.org/activemq-5153-release.html" target="_blank" rel="noopener">ActiveMQ下载</a><br><img src="https://upload-images.jianshu.io/upload_images/3110861-eaa4a6377780ae98.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图3.png"></p>
<ul>
<li>bin (windows下面的bat(分32、64位)和unix/linux下面的sh)</li>
<li>conf (activeMQ配置目录，包含最基本的activeMQ配置文件）</li>
<li>data (默认是空的)</li>
<li>docs (index,replease版本里面没有文档，-.-b不知道为啥不带）</li>
<li>example (几个例子)</li>
<li>lib (activemMQ使用到的lib)</li>
<li>webapps 注意ActiveMQ自带Jetty提供Web管控台</li>
<li>webapps-demo 示例</li>
<li>activemq-all-5.15.3.jar</li>
<li>LICENSE.txt</li>
<li>README.txt</li>
</ul>
<p>######5). 配置</p>
<ul>
<li>Web控制台账号和密码(<code>apache-activemq-5.15.3\conf</code>)<br><img src="https://upload-images.jianshu.io/upload_images/3110861-e6007bd47c40d507.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图4.png"></li>
<li>网络端口(<code>apache-activemq-5.15.3\conf</code>)–默认为8161<br><img src="https://upload-images.jianshu.io/upload_images/3110861-b751546476bcbdef.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图5.png"><br>######6). 启动<br><code>\apache-activemq-5.15.3\bin\win64\</code>目录下双击activemq.bat文件，在浏览器中输入<code>http://localhost:8161/admin/</code>, 用户名和密码输入<code>admin</code>即可<br><img src="https://upload-images.jianshu.io/upload_images/3110861-2bb93e71e0548882.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图6.png"><br>######6). 消息中间件(MOM：Message Orient middleware)<br>消息中间件有很多的用途和优点： </li>
<li>1 将数据从一个应用程序传送到另一个应用程序，或者从软件的一个模块传送到另外一个模块； </li>
<li><ol start="2">
<li>负责建立网络通信的通道，进行数据的可靠传送。 </li>
</ol>
</li>
<li><ol start="3">
<li>保证数据不重发，不丢失 </li>
</ol>
</li>
<li><ol start="4">
<li>能够实现跨平台操作，能够为不同操作系统上的软件集成技工数据传送服务<br>######7).什么情况下使用ActiveMQ?</li>
</ol>
</li>
<li>多个项目之间集成<br>(1) 跨平台<br>(2) 多语言<br>(3) 多项目</li>
<li>降低系统间模块的耦合度，解耦<br>(1) 软件扩展性</li>
<li>系统前后端隔离<br>(1) 前后端隔离，屏蔽高安全区<br>####2. ActiveMQ 示例<br>######1). P2P 示例<br>I. 导包–activemq-all-5.15.3.jar<br>II. Producer<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 定义消息的生产者</span><br><span class="line"> * @author mazaiting</span><br><span class="line"> */</span><br><span class="line">public class Producer &#123;</span><br><span class="line">	// 用户名</span><br><span class="line">	private static final String USERNAME = ActiveMQConnection.DEFAULT_USER;</span><br><span class="line">	// 密码</span><br><span class="line">	private static final String PASSWORD = ActiveMQConnection.DEFAULT_PASSWORD;</span><br><span class="line">	// 链接</span><br><span class="line">	private static final String BROKENURL = ActiveMQConnection.DEFAULT_BROKER_URL;</span><br><span class="line">	</span><br><span class="line">	/**</span><br><span class="line">	 * 定义消息并发送，等待消息的接收者(消费者)消费此消息</span><br><span class="line">	 * @param args</span><br><span class="line">	 * @throws JMSException </span><br><span class="line">	 */</span><br><span class="line">	public static void main(String[] args) throws JMSException &#123;</span><br><span class="line">		// 消息中间件的链接工厂</span><br><span class="line">		ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(</span><br><span class="line">				USERNAME, PASSWORD, BROKENURL);</span><br><span class="line">		// 连接</span><br><span class="line">		Connection connection = null;</span><br><span class="line">		// 会话</span><br><span class="line">		Session session = null;</span><br><span class="line">		// 消息的目的地</span><br><span class="line">		Destination destination = null;</span><br><span class="line">		// 消息生产者</span><br><span class="line">		MessageProducer messageProducer = null;</span><br><span class="line">		</span><br><span class="line">		try &#123;</span><br><span class="line">			// 通过连接工厂获取链接</span><br><span class="line">			connection = connectionFactory.createConnection();</span><br><span class="line">			// 创建会话，进行消息的发送</span><br><span class="line">			// 参数一：是否启用事务</span><br><span class="line">			// 参数二：设置自动签收</span><br><span class="line">			session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);</span><br><span class="line">			// 创建消息队列</span><br><span class="line">			destination = session.createQueue(&quot;talkWithMo&quot;);</span><br><span class="line">			// 创建一个消息生产者</span><br><span class="line">			messageProducer = session.createProducer(destination);</span><br><span class="line">			// 设置持久化/非持久化， 如果非持久化，MQ重启后可能后导致消息丢失</span><br><span class="line">			messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);</span><br><span class="line">			// 模拟发送消息</span><br><span class="line">			for (int i = 0; i &lt; 5; i++) &#123;</span><br><span class="line">				TextMessage textMessage = session.createTextMessage(&quot;给妈妈发送的消息:&quot;+i);</span><br><span class="line">				System.out.println(&quot;textMessage: &quot; + textMessage);</span><br><span class="line">				messageProducer.send(textMessage);</span><br><span class="line">			&#125;</span><br><span class="line">			</span><br><span class="line">			// 如果设置了事务，会话就必须提交</span><br><span class="line">			session.commit();</span><br><span class="line">		&#125; catch (JMSException e) &#123;</span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		&#125; finally &#123;</span><br><span class="line">			if (null != connection) &#123;</span><br><span class="line">				connection.close();</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>III. Consumer<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line"> * 定义消息的消费者</span><br><span class="line"> * @author mazaiting</span><br><span class="line"> */</span><br><span class="line">public class Consumer &#123;</span><br><span class="line">	// 用户名</span><br><span class="line">	private static final String USERNAME = ActiveMQConnection.DEFAULT_USER;</span><br><span class="line">	// 密码</span><br><span class="line">	private static final String PASSWORD = ActiveMQConnection.DEFAULT_PASSWORD;</span><br><span class="line">	// 链接</span><br><span class="line">	private static final String BROKENURL = ActiveMQConnection.DEFAULT_BROKER_URL;</span><br><span class="line">	</span><br><span class="line">	/**</span><br><span class="line">	 * 接收消息</span><br><span class="line">	 * @param args</span><br><span class="line">	 * @throws JMSException </span><br><span class="line">	 */</span><br><span class="line">	public static void main(String[] args) throws JMSException &#123;</span><br><span class="line">		// 消息中间件的链接工厂</span><br><span class="line">		ConnectionFactory connectionFactory = null;</span><br><span class="line">		// 链接</span><br><span class="line">		Connection connection = null;</span><br><span class="line">		// 会话</span><br><span class="line">		Session session = null;</span><br><span class="line">		// 消息的目的地</span><br><span class="line">		Destination destination = null;</span><br><span class="line">		// 消息的消费者</span><br><span class="line">		MessageConsumer messageConsumer = null;</span><br><span class="line">		// 实例化链接工厂，创建一个链接</span><br><span class="line">		connectionFactory = new ActiveMQConnectionFactory(USERNAME, PASSWORD, BROKENURL);</span><br><span class="line">		</span><br><span class="line">		try &#123;</span><br><span class="line">			// 通过工厂获取链接</span><br><span class="line">			connection = connectionFactory.createConnection();</span><br><span class="line">			// 启动链接</span><br><span class="line">			connection.start();</span><br><span class="line">			// 创建会话，进行消息的接收</span><br><span class="line">			session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);</span><br><span class="line">			// 创建消息队列</span><br><span class="line">			destination = session.createQueue(&quot;talkWithMo&quot;);</span><br><span class="line">			// 创建一个消息的消费者</span><br><span class="line">			messageConsumer = session.createConsumer(destination);</span><br><span class="line">			</span><br><span class="line">			// 模拟接收消息</span><br><span class="line">			while (true) &#123;</span><br><span class="line">				TextMessage textMessage = (TextMessage) messageConsumer.receive(10000);</span><br><span class="line">				if (null != textMessage) &#123;</span><br><span class="line">					System.out.println(&quot;收到消息： &quot; + textMessage);</span><br><span class="line">				&#125; else &#123;</span><br><span class="line">					break;</span><br><span class="line">				&#125;</span><br><span class="line">			&#125;</span><br><span class="line">			// 提交</span><br><span class="line">			session.commit();</span><br><span class="line">		&#125; catch (JMSException e) &#123;</span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		&#125; finally &#123;</span><br><span class="line">			if (null != connection) &#123;</span><br><span class="line">				connection.close();</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>IV. 测试</p>
<ul>
<li>先运行生产者Producer<br><img src="https://upload-images.jianshu.io/upload_images/3110861-60f633b1ad599ad8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图7.png"></li>
</ul>
<p>ActiveMQ控制台<br><img src="https://upload-images.jianshu.io/upload_images/3110861-b576c10c60587ddf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图8.png"></p>
<ul>
<li>再运行消费者Consumer<br><img src="https://upload-images.jianshu.io/upload_images/3110861-50613bc466bd4c5e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图9.png"><br>ActiveMQ控制台<br><img src="https://upload-images.jianshu.io/upload_images/3110861-8be89270a680738f.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图10.png"></li>
</ul>
<p>V. 消息类型</p>
<ul>
<li>StreamMessage Java原始值的数据流</li>
<li>MapMessage 一套名称-键值对</li>
<li>TextMessage 一个字符串对象</li>
<li>ObjectMessage 一个序列号的Java对象</li>
<li>BytesMessage 一个未解释字节的数据流<br>VI. 控制台 Queue</li>
<li>Messages Enqueued：表示生产了多少条消息，记做P</li>
<li>Messages Dequeued：表示消费了多少条消息，记做C</li>
<li>Number Of Consumers：表示在该队列上还有多少消费者在等待接受消息</li>
<li>Number Of Pending Messages：表示还有多少条消息没有被消费，实际上是表示消息的积压程度，就是P-C<br>VII. 签收<br>签收就是消费者接受到消息后，需要告诉消息服务器，我收到消息了。当消息服务器收到回执后，本条消息将失效。因此签收将对PTP模式产生很大影响。如果消费者收到消息后，并不签收，那么本条消息继续有效，很可能会被其他消费者消费掉！</li>
<li>AUTO_ACKNOWLEDGE：表示在消费者receive消息的时候自动的签收</li>
<li>CLIENT_ACKNOWLEDGE：表示消费者receive消息后必须手动的调用acknowledge()方法进行签收</li>
<li>DUPS_OK_ACKNOWLEDGE：签不签收无所谓了，只要消费者能够容忍重复的消息接受，当然这样会降低Session的开销</li>
</ul>
<p>######2). request/reply模型<br>I. 实现思路<br><img src="https://upload-images.jianshu.io/upload_images/3110861-3ed7988fa7d20d2b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图11.png"><br>Client的Producer发出一个JMS message形式的request，request上附加了一些额外的属性：</p>
<ul>
<li>correlation ID(用来和返回的correlation ID对比进行验证)，</li>
<li>JMSReplyTo属性(放置jms message的destination，这样worker的Consumer获得jms message就能得到destination)</li>
</ul>
<p>Worker的consumer收到requset，处理request并用producer发出reply，destination就从requset的JMSReplyTo属性中得到。</p>
<p>II. Server代码<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br></pre></td><td class="code"><pre><span class="line">public class Server implements MessageListener &#123;</span><br><span class="line">	// 经纪人链接</span><br><span class="line">	private static final String BROKER_URL = &quot;tcp://localhost:61616&quot;;</span><br><span class="line">	// 请求队列</span><br><span class="line">	private static final String REQUEST_QUEUE = &quot;requestQueue&quot;;</span><br><span class="line">	// 经纪人服务</span><br><span class="line">	private BrokerService brokerService;</span><br><span class="line">	// 会话</span><br><span class="line">	private Session session;</span><br><span class="line">	// 生产者</span><br><span class="line">	private MessageProducer producer;</span><br><span class="line">	// 消费者</span><br><span class="line">	private MessageConsumer consumer;</span><br><span class="line">	</span><br><span class="line">	private void start() throws Exception &#123;</span><br><span class="line">		createBroker();</span><br><span class="line">		setUpConsumer();</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	/**</span><br><span class="line">	 * 创建经纪人</span><br><span class="line">	 * @throws Exception </span><br><span class="line">	 */</span><br><span class="line">	private void createBroker() throws Exception &#123;</span><br><span class="line">		// 创建经纪人服务</span><br><span class="line">		brokerService = new BrokerService();</span><br><span class="line">		// 设置是否持久化</span><br><span class="line">		brokerService.setPersistent(false);</span><br><span class="line">		// 设置是否使用JMX</span><br><span class="line">		brokerService.setUseJmx(false);</span><br><span class="line">		// 添加链接</span><br><span class="line">		brokerService.addConnector(BROKER_URL);</span><br><span class="line">		// 启动</span><br><span class="line">		brokerService.start();</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	/**</span><br><span class="line">	 * 设置消费者</span><br><span class="line">	 * @throws JMSException </span><br><span class="line">	 */</span><br><span class="line">	private void setUpConsumer() throws JMSException &#123;</span><br><span class="line">		// 创建连接工厂</span><br><span class="line">		ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(BROKER_URL);</span><br><span class="line">		// 创建连接</span><br><span class="line">		Connection connection = connectionFactory.createConnection();</span><br><span class="line">		// 启动连接</span><br><span class="line">		connection.start();</span><br><span class="line">		// 创建Session</span><br><span class="line">		session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</span><br><span class="line">		// 创建队列</span><br><span class="line">		Destination adminQueue = session.createQueue(REQUEST_QUEUE);</span><br><span class="line">		// 创建生产者</span><br><span class="line">		producer = session.createProducer(null);</span><br><span class="line">		// 设置持久化模式</span><br><span class="line">		producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);</span><br><span class="line">		// 创建消费者</span><br><span class="line">		consumer = session.createConsumer(adminQueue);</span><br><span class="line">		// 消费者设置消息监听</span><br><span class="line">		consumer.setMessageListener(this);</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	public void stop() throws Exception &#123;</span><br><span class="line">		producer.close();</span><br><span class="line">		consumer.close();</span><br><span class="line">		session.close();</span><br><span class="line">		brokerService.stop();</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	@Override</span><br><span class="line">	public void onMessage(Message message) &#123;</span><br><span class="line">		try &#123;</span><br><span class="line">			// 创建新消息</span><br><span class="line">			TextMessage response = this.session.createTextMessage();</span><br><span class="line"></span><br><span class="line">			// 判断消息是否是文本消息</span><br><span class="line">			if (message instanceof TextMessage) &#123;</span><br><span class="line">				// 强转为文本消息 </span><br><span class="line">				TextMessage textMessage = (TextMessage) message;</span><br><span class="line">				// 获取消息内容</span><br><span class="line">				String text = textMessage.getText();</span><br><span class="line">				// 设置消息</span><br><span class="line">				response.setText(handleRequest(text));</span><br><span class="line">			&#125;</span><br><span class="line">			response.setJMSCorrelationID(message.getJMSCorrelationID());</span><br><span class="line">			producer.send(message.getJMSReplyTo(), response);</span><br><span class="line">		&#125; catch (JMSException e) &#123;</span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	/**</span><br><span class="line">	 * 构建消息内容</span><br><span class="line">	 * @param text 文本</span><br><span class="line">	 * @return</span><br><span class="line">	 */</span><br><span class="line">	private String handleRequest(String text) &#123;</span><br><span class="line">		return &quot;Response to &apos;&quot; + text + &quot;&apos;&quot;;</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	public static void main(String[] args) throws Exception &#123;</span><br><span class="line">		Server server = new Server();</span><br><span class="line">		// 启动</span><br><span class="line">		server.start();</span><br><span class="line">		System.out.println();</span><br><span class="line">		System.out.println(&quot;Press any key to stop the server&quot;);</span><br><span class="line">		System.out.println();</span><br><span class="line">		System.in.read();</span><br><span class="line">		server.stop();</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>III. Client代码<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br></pre></td><td class="code"><pre><span class="line">public class Client implements MessageListener &#123;</span><br><span class="line">	// 经纪人链接</span><br><span class="line">	private static final String BROKER_URL = &quot;tcp://localhost:61616&quot;;</span><br><span class="line">	// 请求队列</span><br><span class="line">	private static final String REQUEST_QUEUE = &quot;requestQueue&quot;;</span><br><span class="line">	// 连接</span><br><span class="line">	private Connection connection;</span><br><span class="line">	// 会话</span><br><span class="line">	private Session session;</span><br><span class="line">	// 生产者</span><br><span class="line">	private MessageProducer producer;</span><br><span class="line">	// 消费者</span><br><span class="line">	private MessageConsumer consumer;</span><br><span class="line">	// 请求队列</span><br><span class="line">	private Queue tempDest;</span><br><span class="line">	</span><br><span class="line">	public void start() throws JMSException &#123;</span><br><span class="line">		// 连接工厂</span><br><span class="line">		ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(BROKER_URL);</span><br><span class="line">		// 创建连接</span><br><span class="line">		connection = activeMQConnectionFactory.createConnection();</span><br><span class="line">		// 开启连接</span><br><span class="line">		connection.start();</span><br><span class="line">		// 创建会话</span><br><span class="line">		session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);</span><br><span class="line">		// 创建队列</span><br><span class="line">		Destination adminQueue = session.createQueue(REQUEST_QUEUE);</span><br><span class="line">		// 创建生产者</span><br><span class="line">		producer = session.createProducer(adminQueue);</span><br><span class="line">		// 设置持久化模式</span><br><span class="line">		producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);</span><br><span class="line">		// 创建模板队列</span><br><span class="line">		tempDest = session.createTemporaryQueue();</span><br><span class="line">		// 创建消费者</span><br><span class="line">		consumer = session.createConsumer(tempDest);</span><br><span class="line">		// 设置消息监听</span><br><span class="line">		consumer.setMessageListener(this);		</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	/**</span><br><span class="line">	 * 停止</span><br><span class="line">	 * @throws JMSException </span><br><span class="line">	 */</span><br><span class="line">	public void stop() throws JMSException &#123;</span><br><span class="line">		producer.close();</span><br><span class="line">		consumer.close();</span><br><span class="line">		session.close();</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	/**</span><br><span class="line">	 * 请求</span><br><span class="line">	 * @param request</span><br><span class="line">	 * @throws JMSException </span><br><span class="line">	 */</span><br><span class="line">	public void request(String request) throws JMSException &#123;</span><br><span class="line">		System.out.println(&quot;Request: &quot; + request);</span><br><span class="line">		// 创建文本消息</span><br><span class="line">		TextMessage textMessage = session.createTextMessage();</span><br><span class="line">		// 设置文本内容</span><br><span class="line">		textMessage.setText(request);</span><br><span class="line">		// 设置回复</span><br><span class="line">		textMessage.setJMSReplyTo(tempDest);</span><br><span class="line">		// 获取UUID</span><br><span class="line">		String correlationId = UUID.randomUUID().toString();</span><br><span class="line">		// 设置JMS id</span><br><span class="line">		textMessage.setJMSCorrelationID(correlationId);</span><br><span class="line">		// 发送消息</span><br><span class="line">		this.producer.send(textMessage);</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	@Override</span><br><span class="line">	public void onMessage(Message message) &#123;</span><br><span class="line">		try &#123;</span><br><span class="line">			System.out.println(&quot;Received response for: &quot; + ((TextMessage)message).getText());</span><br><span class="line">		&#125; catch (JMSException e) &#123;</span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	</span><br><span class="line">	public static void main(String[] args) throws JMSException, InterruptedException &#123;</span><br><span class="line">		Client client = new Client();</span><br><span class="line">		// 启动</span><br><span class="line">		client.start();</span><br><span class="line">		int i = 0;</span><br><span class="line">		while(i++ &lt; 10) &#123;</span><br><span class="line">			client.request(&quot;REQUEST- &quot; + i);</span><br><span class="line">		&#125;</span><br><span class="line">		Thread.sleep(3000);</span><br><span class="line">		client.stop();</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></p>
<p>IV. 测试</p>
<ul>
<li>启动Server<br><img src="https://upload-images.jianshu.io/upload_images/3110861-8099356fc7008911.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图12.png"></li>
<li>启动Client<br><img src="https://upload-images.jianshu.io/upload_images/3110861-644a5e340ef23759.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="图13.png"></li>
</ul>
<p>####<a href="https://gitee.com/mazaiting/distributed" target="_blank" rel="noopener">代码下载</a></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2018/08/06/Distributed/分布式---WebSocket-全双工通讯/" rel="next" title="分布式---WebSocket-全双工通讯">
                <i class="fa fa-chevron-left"></i> 分布式---WebSocket-全双工通讯
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2018/08/06/Distributed/分布式--ActiveMQ-消息中间件(二)/" rel="prev" title="分布式--ActiveMQ-消息中间件(二)">
                分布式--ActiveMQ-消息中间件(二) <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/blog/images/avatar.jpeg"
                alt="凌浩雨" />
            
              <p class="site-author-name" itemprop="name">凌浩雨</p>
              <p class="site-description motion-element" itemprop="description">专业从事于移动端开发，Android与iOS均有涉及，主做Android开发与React Native开发</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">393</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            

            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">凌浩雨</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
